﻿package com.sgcc.nfc.lock.domain.model

/**
 * Represents the hierarchy level of a region as defined by the backend.
 *
 * Level mapping (backend contract):
 * 1 -> Headquarters
 * 2 -> Province
 * 3 -> City
 * 4 -> County
 * 5 -> Station
 */
enum class RegionLevel(val value: Int) {
    HEADQUARTERS(1),
    PROVINCE(2),
    CITY(3),
    COUNTY(4),
    STATION(5);

    fun next(): RegionLevel? = when (this) {
        HEADQUARTERS -> PROVINCE
        PROVINCE -> CITY
        CITY -> COUNTY
        COUNTY -> STATION
        STATION -> null
    }

    companion object {
        fun fromValue(value: Int?): RegionLevel? = values().firstOrNull { it.value == value }
    }
}

